#include<iostream>
#include<vector>
using namespace std;

struct TreeNode {
    int val;
    TreeNode* left;
    TreeNode* right;
    TreeNode() : val(0), left(nullptr), right(nullptr) {}
    TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
    TreeNode(int x, TreeNode* left, TreeNode* right) : val(x), left(left),
         right(right) {}
};

class Solution1 {
public:
    void dfs(TreeNode* root, vector<int>& retv) {
        if (root) {
            retv.push_back(root->val);
            dfs(root->left, retv);
            dfs(root->right, retv);
        }
    }

    vector<int> preorderTraversal(TreeNode* root) {
        vector<int> retv;
        dfs(root, retv);
        return retv;
    }
};

class Solution2 {
public:
    void dfs(TreeNode* root, vector<int>& retv)
    {
        if (!root) return;
        dfs(root->left, retv);
        retv.push_back(root->val);
        dfs(root->right, retv);
    }
    vector<int> inorderTraversal(TreeNode* root) {
        vector<int>retv;
        dfs(root, retv);
        return retv;
    }
};

class Solution3 {
public:
    void dfs(TreeNode* root, vector<int>& retv)
    {
        if (!root) return;
        dfs(root->left, retv);
        dfs(root->right, retv);
        retv.push_back(root->val);
    }
    vector<int> postorderTraversal(TreeNode* root) {
        vector<int>retv;
        dfs(root, retv);
        return retv;
    }
};



int main() {

	return 0;
}